<?php

namespace App\Console\Commands\Data;

use App\Kuafu\Mybank\Model\MybankBillRecordModel;
use App\Kuafu\Shop\Model\ShopMonitorDataModel;
use Illuminate\Console\Command;

class TimingDeleteDataCommand extends Command
{

    protected $signature   = 'data:timingDeleteData';
    protected $description = '定时删数据';

    public function handle()
    {
        // 往前推 30天
        $deleteTimestamp = strtotime('-30 days');

        // 网商银行数据删除
        $mybankBillRecordModelDeleteResult = MybankBillRecordModel::query()
                                                                  ->where('createdAt', '<', $deleteTimestamp)
                                                                  ->delete();

        // 往前推 7 天
        $deleteTimestamp = strtotime('-3 days');

        // 删除客流等数据
        $shopMonitorDataModelDeleteResult = ShopMonitorDataModel::query()
                                                                ->where('createdAt', '<', $deleteTimestamp)
                                                                ->delete();


    }


}
